package com.google.enterprise.gcs.search;

import android.os.Parcel;
import android.os.Parcelable;


// TODO:  ListItem object should accept the entire 'com.google.api.services.shopping.model.Product"
// class as a parameter so we dont' have to have get/set methods for each property
// the todo here is to figure out the correct OO way to transmit the entire Product object 
// (maybe serialize or as string or get Product implement Parcelable?...

public class ListItem implements Parcelable {
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getItemDescription() {
		return itemDescription;
	}
	public void setItemDescription(String itemDescription) {
		this.itemDescription = itemDescription;
	}
	public String getPrice() {
		return price;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public String getImageURL() {
		return imageURL;
	}
	public void setImageURL(String imageURL) {
		this.imageURL = imageURL;
	}
	public String getOfferURL() {
		return offerURL;
	}
	public void setOfferURL(String offerURL) {
		this.offerURL = offerURL;
	}	
	
	private String title ;
	private String itemDescription;
	private String price;
	private String imageURL;
	private String offerURL;

	public ListItem() {}
	
	public ListItem(Parcel source) {
		title = source.readString();
	    itemDescription = source.readString();
	    price = source.readString();
	    imageURL = source.readString();
	    offerURL = source.readString();
	}
	
	public ListItem(String title, String itemDescription, String price, String imageURL, String offerURL) {
	    this.title = title;
	    this.itemDescription = itemDescription;
	    this.price = price;
	    this.imageURL = imageURL;
	    this.offerURL = offerURL;
	}
	
	@Override
	public int describeContents() {
	return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
	out.writeString(title);
	out.writeString(itemDescription);
	out.writeString(price);
	out.writeString(imageURL);
	out.writeString(offerURL);	
	}

	public static final Parcelable.Creator<ListItem> CREATOR
	      = new Parcelable.Creator<ListItem>() {
	
		@Override
    public ListItem createFromParcel(Parcel in) {
		    return new ListItem(in);
		}
	
		@Override
    public ListItem[] newArray(int size) {
		    return new ListItem[size];
		}	
	};
}
